<template>
	<view class="content with-tabbar">

		<scroll-view v-if="postForm" class="pt-18 pb-18 pl-30 pr-30 bg-fff" style="white-space: normal;" scroll-y>
			<div class=" ">
				<div class="head flex-center pb-34 bor-b">
					<image class="headImg img-104" mode="aspectFill" :src="baseUrl + postForm.headImg" />
					<div class="ml-28">
						<div class="fontS28 font-500"><span class="fontS40 ">{{ postForm.name }}·</span>{{ postForm.sex
							=== '0' ? '男' :
							'女' }}</div>
						<div class="fontS24 color6 mt-8">{{ postForm.experienceRequireName }} ｜ {{
							postForm.highEducationName }}
							|
							{{ postForm.age }}岁 ｜ {{ postForm.cityName }}
						</div>
					</div>

				</div>
				<div class="pt-34 pb-34 bor-b">
					<div class="font-bold fontS36 color-0d0 mb-14">联系方式</div>
					<div class="flex-center">
						<div>
							<div class="flex-center mt-10 lh-50 fontS28 color-6">
								<div class="iconfont icon-xiaotubiao-01"></div>
								<div class="ml-20">{{ postForm.phone }}</div>
							</div>
							<div class="flex-center mt-10 lh-50 fontS28 color-6" v-if="postForm.wx">
								<div class="iconfont icon-xiaotubiao-02"></div>
								<div class="ml-20">{{ postForm.wx }}</div>
							</div>
							<div class="flex-center mt-10 lh-50 fontS28 color-6" v-if="postForm.email">
								<div class="iconfont icon-xiaotubiao-03"></div>
								<div class="ml-20">{{ postForm.email || '' }}</div>
							</div>
						</div>

					</div>
				</div>
				<div class="pt-34 pb-34 bor-b">
					<div class="font-bold fontS36 color-0d0 mb-14">求职状态</div>
					<div class="fontS28 lh-50">{{ postForm.jobSeekName }}</div>

				</div>
				<div class="pt-34 pb-34 bor-b" @click="toEdit('creat4')">
					<div class="font-bold fontS36 color-0d0 mb-14">个人优势</div>
					<div class="flex-center lh-50 color-0d0 fontS28">
						<div class="">{{ postForm.advantage || '' }}</div>

					</div>
				</div>

				<div class="pt-34 pb-14 bor-b">
					<div class="flex-center" @click="toEdit('creat5')">
						<div class="font-bold fontS36 color-0d0 mb-14">求职期望</div>

					</div>
					<div v-for="(item, index) in postForm.resumeExpectList" :key="index"
						class="flex-center mb-20 bg-f7 p-20" @click="toEdit('expect', item.id)">
						<div>
							<div class="fontS32 font-500 color-0d0 lh-52">{{ item.expectTypeName || '' }}</div>
							<div class="flex-center fontS28 mt-2 lh-52">
								<div>{{ item.professionName }}</div>
								<div class="ml-36">{{ item.minSalary || 0 }}K-{{ item.maxSalary || 0 }}K</div>

							</div>
							<div class="color-6 fontS24 lh-44 mt-2">{{ item.cityName || '' }}·{{ item.industryNames ||
								''
							}}
							</div>
						</div>


					</div>
				</div>
				<div class="pt-34 pb-14 bor-b">
					<div class="flex-center">
						<div class="font-bold fontS36 color-0d0 mb-14">工作经历</div>

					</div>
					<div v-for="(item, index) in postForm.resumeWorkList" :key="index"
						class="flex-center mb-20 bg-f7 p-20">
						<div style="width: calc(100% - 40upx);">
							<div class=" color-0d0 lh-52 flex-center">
								<div class="fontS32 font-500">{{ item.companyName || "" }}</div>
								<div v-if="item.isInternship" class="isInternship ml-10">实习</div>
								<div class="ml-auto fontS24 color-6">{{ item.startWorkDate || "" }} - {{
									item.endWorkDate || "" }}
								</div>
							</div>
							<div>{{ item.professionName || "" }}</div>


							<div class="color-6 fontS24 lh-44 mt-2">工作内容：{{ item.workContent || "" }}</div>
							<!-- 职业优势 -->
							<div></div>
						</div>


					</div>
				</div>
				<div class="pt-34 pb-14 bor-b">
					<div class="flex-center">
						<div class="font-bold fontS36 color-0d0 mb-14">教育经历</div>

					</div>
					<div v-for="(item, index) in postForm.resumeEducationList" :key="index"
						class="flex-center mb-20 bg-f7 p-20">
						<div style="width: calc(100% - 40upx);">
							<div class="color-0d0 lh-52 flex">
								<div class="fontS32 font-500">{{ item.schoolName || "" }}</div>
								<div class="ml-auto fontS24 color-6">{{ item.minStudyDate || "" }} - {{
									item.maxStudyDate || "" }}
								</div>
							</div>
							<div>{{ item.educationName || "" }} · {{ item.majorName || "" }} · {{ item.customMajorName ||
								"" }}</div>
							<div class="color-6 fontS24 lh-44 mt-2 ">在校经历：{{ item.schoolExperience || "" }}</div>
						</div>


					</div>
				</div>
				<div class="pt-34 pb-14">
					<div class="font-bold fontS36 color-0d0 mb-14">资格证书</div>
					<image @click="preView" class="certImg" mode="aspectFill" :src="baseUrl + postForm.certificate" />
				</div>



			</div>
		</scroll-view>




	</view>
</template>

<script>
import { resume, onLineResume, editSeekJobStatus } from '@/api/resume'
const api = require("@/api/api.js").api;
export default {
	computed: {
		userInfo() {
			console.log(this.$store.getters.userInfo)
			return this.$store.getters.userInfo || {};
		},
	},
	data() {
		return {
			baseUrl: getApp().globalData.baseUrl,
			postForm: null,
			value: '',
			sexList: getApp().globalData.sexList,
			eduList: getApp().globalData.education,
			experienceList: getApp().globalData.experience,
			jobSeekList: getApp().globalData.jobSeek,
			regionList: [],
			postStatus: false
		}
	},
	onLoad() {
		// this.getRegion()

	},
	onShow() {
		this.getonLineResume()
	},
	methods: {
		async getonLineResume() {
			const { data } = await onLineResume()
			this.postForm = data
		},
		async getRegion() {
			const { data } = await api.region.regionList()
			this.regionList = data
		},
		async change(e, type) {
			if (type === 'jobSeek') this.postForm.jobSeekStatus = e.detail.value
			const { data } = await editSeekJobStatus(this.postForm)
		},
		async toEdit(url, typeId, resumeId, item, flag) {
			uni.navigateTo({
				url: `${url}?resumeId=${resumeId}&id=${typeId}&page=edit&item=${item ? JSON.stringify(item) : ''}&flag=${flag}`
			})
		},

		async preView() {
			uni.previewImage({
				urls: [this.baseUrl + this.postForm.certificate],

			})



		},

	}
}
</script>

<style lang="less" scoped>
.content {
	display: flex;
	flex-direction: column;
	background: #fff;
	padding: 20upx;

}

// .bottom {
// 	padding-bottom: calc(constant(safe-area-inset-bottom) + 22upx);
// 	/*兼容 IOS<11.2*/
// 	padding-bottom: calc(env(safe-area-inset-bottom) + 22upx);
// 	/*兼容 IOS>11.2*/
// }

.headImg {
	min-width: 110upx;
	min-height: 110upx;
}

.color-0d0 {
	color: #0D0D12;
}

.isInternship {
	height: 32upx;
	line-height: 28upx;
	border-radius: 8upx;
	border: 1px solid #FF6601;
	color: #FF6601;
	font-size: 22upx;
	padding: 0 10upx;

}

.certImg {
	width: 100%;
	height: 300upx;
	padding: 20upx;
	border-radius: 8upx;
	border: 1px dashed #34A76C;
}

.bg-f7 {
	background: #f7f8f7;
}
</style>
